from typing import List


class Solution:
    def removeElement(self, nums: List[int], val: int) -> int:

        # while val in nums:
        #     nums.pop(nums.index(val))

        # 快慢指针
        i, j = 0, 0
        for j in range(0, len(nums)):
            if nums[j] != val:
                nums[i] = nums[j]
                i += 1
